home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
clib
/
sys
/
h
/
unix
< prev
next >
Wrap
Text File
|
1996-11-09
|
5KB
|
211 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/clib/sys/h/RCS/unix,v $
* $Date: 1996/11/06 22:01:41 $
* $Revision: 1.5 $
* $State: Rel $
* $Author: unixlib $
*
* UNIX is a registered trademark of AT&T Bell Laboratories
*
* $Log: unix,v $
* Revision 1.5 1996/11/06 22:01:41 unixlib
* Yet more changes by NB, PB and SC.
*
* Revision 1.4 1996/10/30 22:04:51 unixlib
* Massive changes made by Nick Burret and Peter Burwood.
*
* Revision 1.3 1996/07/21 22:15:12 unixlib
* CL_0001 Nick Burret
* Improve memory handling. Remove C++ library incompatibilities.
* Improve file stat routines.
*
* Revision 1.2 1996/05/06 09:03:13 unixlib
* Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
* Saved for 3.7a release.
*
* Revision 1.1 1996/04/19 21:23:56 simon
* Initial revision
*
***************************************************************************/
#ifndef __SYS_UNIX_H
#define __SYS_UNIX_H
#ifndef __UNIXLIB_TYPES_H
#include <unixlib/types.h>
#endif
#ifndef __SYS_TTY_H
#include <sys/tty.h>
#endif
#ifndef __SETJMP_H
#include <setjmp.h>
#endif
#ifndef __SYS_DEV_H
#include <sys/dev.h>
#endif
#ifndef __SYS_TIME_H
#include <sys/time.h>
#endif
#ifndef __SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifndef __LIMITS_H
#include <limits.h>
#endif
#ifndef __UNIXLIB_SIGSTATE_H
#include <unixlib/sigstate.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* the 2 functions below are automatically called in normal circumstances */
extern void __unixinit(void); /* initialise UNIX */
extern void __unixexit(void); /* shutdown UNIX */
extern int __fdalloc(void);
struct __process
{
/* This process has a parent process. */
unsigned int has_parent : 1;
/* This process terminated through a signal handler. */
unsigned int signal_exit : 1;
/* This process terminated with a core dump. */
unsigned int core_dump : 1;
/* This process just stopped. */
unsigned int stopped : 1;
/* This process is controlling the tty. */
unsigned int tty_control : 1;
/* The type of tty this process is controlling. */
unsigned int tty_type : 8;
/* The number of the signal we terminated with. */
unsigned int signal : 8;
/* The return code of this process. */
unsigned int return_code : 8;
};
struct __child_process
{
__uid_t uid;
__gid_t gid;
__pid_t pid;
int ppri, gpri, upri;
struct __process status;
struct rusage usage;
/* Process context. */
jmp_buf vreg;
};
#define _PROCMAGIC 0xfedcfa5f
struct proc
{
/* Magic word */
int __magic;
/* main(argc,argv) */
int argc;
char **argv, *argb;
/* FD set */
struct file file[MAXFD];
struct tty *tty;
/* real/effective user ID */
__uid_t uid, euid;
/* real/effective group ID */
__gid_t gid, egid;
/* process group ID */
__pid_t pgrp;
/* process id */
__pid_t pid;
/* parent process id */
__pid_t ppid;
/* priority: process, process group, user process */
int ppri, gpri, upri;
/* File creation mask. */
__mode_t umask;
/* status for this particular process */
struct __process status;
/* interval timers */
struct itimerval itimers[__MAX_ITIMERS];
/* resource limits */
struct rlimit limit[RLIMIT_NLIMITS];
/* current resource usage */
struct rusage usage;
/* parent's struct proc */
struct proc *pproc;
/* Details recorded about stopped or terminated children. */
struct __child_process child[CHILD_MAX];
/* The signal states for this process. */
struct unixlib_sigstate sigstate;
/* Set to 1 if this process is currently sleeping, orphaned or stopped.
These could change at any time. */
volatile int sleeping, orphaned, stopped;
/* Preemptive-signal states. */
struct unixlib_signal_preempt *sigpreempt[NSIG];
/* Process context. */
jmp_buf vreg;
};
extern struct proc *__u; /* current process */
struct sfile /* special file list */
{
char *name;
__dev_t dev;
};
extern struct sfile __sfile[]; /* defined in open.c */
struct sdir /* special directory list */
{
char *name;
char *riscos_name;
};
#define MAXSDIR 16
extern struct sdir __sdir[MAXSDIR]; /* defined in unix.c */
#define MAXSFIX 48
extern char *__sfix[MAXSFIX]; /* special suffix list */
struct pipe
{
struct file *p[2];
char *file;
struct pipe *next;
};
extern struct pipe *__pipe; /* list of currently active pipes */
extern int __envcnt,__envsiz; /* count of strings in **environ */
extern char *__addenv(const char *,char *); /* add/replace string,value */
extern char *__chkenv(const char *); /* check if string exists in **environ */
extern char *__getenv(const char *,int);
extern int __intenv(const char *,int); /* integer getenv() - 0 if nonexistent */
extern char *__permstr(const char *); /* malloc() + memcpy() */
/* Find first freely available child. */
extern int __find_free_child (void);
extern void __printf_init (void);
/* Make unique (but not random) file serial numbers for readdir()
and stat(). */
extern unsigned int __get_file_serial_no (char *);
/* Print an error and exit the process. */
extern void __unixlib_fatal (char *s);
#ifdef __cplusplus
}
#endif
#endif